package com.order.service.impl;

import com.fegin.clients.UserClient;
import com.fegin.pojo.User;
import com.order.mapper.OrderMapper;
import com.order.pojo.Order;
import com.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author zx
 * @date 2021/11/12 21:34
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderMapper orderMapper;

    @Autowired
    UserClient userClient;

    @Override
    public Order fandById(Long id) {
        Order order=orderMapper.fandById(id);
        User user = userClient.findById(order.getUserId());
        order.setUser(user);
        return order;
    }
}
